<!DOCTYPE html>
<html>
  <head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8">
  <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">
  <meta name="description" content="tong.li&#39;s blog">
  <meta name="keyword" content="彤哥哥博客，95后技术爱好者,现就职于同程旅行/同程艺龙上海分公司，专注于互联网技术分享的平台。">
  
    <link rel="shortcut icon" href="/css/images/icon.png">
  
  <title>
    
      彤哥哥的博客
    
  </title>
  <link href="https://cdn.staticfile.org/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
  <link href="https://cdn.staticfile.org/nprogress/0.2.0/nprogress.min.css" rel="stylesheet">
  <link href="https://cdn.staticfile.org/highlight.js/9.12.0/styles/tomorrow-night.min.css" rel="stylesheet">
  
<link rel="stylesheet" href="/css/style.css">

  
  <script src="https://cdn.staticfile.org/jquery/3.2.1/jquery.min.js"></script>
  <script src="https://cdn.staticfile.org/geopattern/1.2.3/js/geopattern.min.js"></script>
  <script src="https://cdn.staticfile.org/nprogress/0.2.0/nprogress.min.js"></script>
  
    
<script src="/js/qrious.js"></script>

  
  
  
  
    <!-- MathJax support START -->
    <script type="text/x-mathjax-config">
      MathJax.Hub.Config({
        tex2jax: {
          inlineMath: [ ['$','$'], ["\\(","\\)"]  ],
          processEscapes: true,
          skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
        }
      });
    </script>

    <script type="text/x-mathjax-config">
      MathJax.Hub.Queue(function() {
        var all = MathJax.Hub.getAllJax(), i;
        for (i=0; i < all.length; i += 1) {
          all[i].SourceElement().parentNode.className += ' has-jax';
        }
      });
    </script>
    <script type="text/javascript" src="https://cdn.staticfile.org/mathjax/2.7.5/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
    <!-- MathJax support END -->
  


  
  
    
<script src="/js/local-search.js"></script>


<meta name="generator" content="Hexo 5.4.2"></head>
<div class="wechat-share">
  <img src="/css/images/logo.png" />
</div>
  <body>
    <header class="header fixed-header">
  <div class="header-container">
    <a class="home-link" href="/">
      <div class="logo"></div>
      <span>彤哥哥的博客</span>
    </a>
    <ul class="right-list">
      
        <li class="list-item">
          
            <a href="/" class="item-link active">主页</a>
          
        </li>
      
        <li class="list-item">
          
            <a href="/series/" class="item-link">分类</a>
          
        </li>
      
        <li class="list-item">
          
            <a href="/tags/" class="item-link">标签</a>
          
        </li>
      
        <li class="list-item">
          
            <a href="/archives/" class="item-link">归档</a>
          
        </li>
      
        <li class="list-item">
          
            <a href="/project/" class="item-link">项目</a>
          
        </li>
      
        <li class="list-item">
          
            <a href="/about/" class="item-link">关于</a>
          
        </li>
      
      
        <li class="menu-item menu-item-search right-list">
    <a role="button" class="popup-trigger">
        <i class="fa fa-search fa-fw"></i>
    </a>
</li>
      
    </ul>
    <div class="menu">
      <span class="icon-bar"></span>
      <span class="icon-bar"></span>
      <span class="icon-bar"></span>
    </div>
    <div class="menu-mask">
      <ul class="menu-list">
        
          <li class="menu-item">
            
              <a href="/" class="menu-link mobile-active">主页</a>
            
          </li>
        
          <li class="menu-item">
            
              <a href="/series/" class="menu-link">分类</a>
            
          </li>
        
          <li class="menu-item">
            
              <a href="/tags/" class="menu-link">标签</a>
            
          </li>
        
          <li class="menu-item">
            
              <a href="/archives/" class="menu-link">归档</a>
            
          </li>
        
          <li class="menu-item">
            
              <a href="/project/" class="menu-link">项目</a>
            
          </li>
        
          <li class="menu-item">
            
              <a href="/about/" class="menu-link">关于</a>
            
          </li>
        
      </ul>
    </div>
    
      <div class="search-pop-overlay">
    <div class="popup search-popup">
        <div class="search-header">
            <span class="search-icon">
                <i class="fa fa-search"></i>
            </span>
            <div class="search-input-container">
                <input autocomplete="off" autocapitalize="off"
                    placeholder="Please enter your keyword(s) to search." spellcheck="false"
                    type="search" class="search-input">
            </div>
            <span class="popup-btn-close">
                <i class="fa fa-times-circle"></i>
            </span>
        </div>
        <div id="search-result">
            <div id="no-result">
                <i class="fa fa-spinner fa-pulse fa-5x fa-fw"></i>
            </div>
        </div>
    </div>
</div>
    
  </div>
</header>

    <main class="app-body">
  
    <article class="article-card">
      <h2 class="article-head">
        <a href="/2018/01/30/Spring%20Cloud-%E4%BD%BF%E7%94%A8%E9%AB%98%E6%80%A7%E8%83%BD%E7%9A%84OkHttp%E5%BA%93/">Spring Cloud-使用高性能的OkHttp库</a>
      </h2>
      <p class="article-date">January 30, 2018</p>
      
        
  <a href="/tags#Spring Cloud" >
    <span class="tag-code">Spring Cloud</span>
  </a>

      
      <div class="article-summary">
        
          最近在做项目优化,研究了Spring Cloud底层源码,Http请求库默认是Apache HttpClient或者JDK自带的HttpURLConnection库.Java标准库提供了HttpURLConnection类来支持HTTP通讯。不过HttpURLConnection本身的API ...
        
      </div>
      <a class="more" href="/2018/01/30/Spring%20Cloud-%E4%BD%BF%E7%94%A8%E9%AB%98%E6%80%A7%E8%83%BD%E7%9A%84OkHttp%E5%BA%93/">阅读更多</a>
    </article>
  
    <article class="article-card">
      <h2 class="article-head">
        <a href="/2017/12/15/ES6%E6%96%B0%E7%9A%84%E6%95%B0%E6%8D%AE%E7%B1%BB%E5%9E%8B-generator/">ES6新的数据类型-generator</a>
      </h2>
      <p class="article-date">December 15, 2017</p>
      
        
  <a href="/tags#JavaScript" >
    <span class="tag-code">JavaScript</span>
  </a>

      
      <div class="article-summary">
        
          新的数据类型-generatorgenerator（生成器）是ES6标准引入的新的数据类型。一个generator看上去像一个函数，但可以返回多次.ES6定义generator标准的哥们借鉴了Python的generator的概念和语法.我们先复习函数的概念。一个函数是一段完整的代码，调用一 ...
        
      </div>
      <a class="more" href="/2017/12/15/ES6%E6%96%B0%E7%9A%84%E6%95%B0%E6%8D%AE%E7%B1%BB%E5%9E%8B-generator/">阅读更多</a>
    </article>
  
    <article class="article-card">
      <h2 class="article-head">
        <a href="/2017/12/15/%E7%AE%AD%E5%A4%B4%E5%87%BD%E6%95%B0/">箭头函数</a>
      </h2>
      <p class="article-date">December 15, 2017</p>
      
        
  <a href="/tags#JavaScript" >
    <span class="tag-code">JavaScript</span>
  </a>

      
      <div class="article-summary">
        
          箭头函数ES6标准新增了一种新的函数：Arrow Function（箭头函数）。为什么叫Arrow Function？因为它的定义用的就是一个箭头:
12var fn = x =&gt; x * x;alert(fn(5));  //25

上面的箭头函数相当于:
1234function  ...
        
      </div>
      <a class="more" href="/2017/12/15/%E7%AE%AD%E5%A4%B4%E5%87%BD%E6%95%B0/">阅读更多</a>
    </article>
  
    <article class="article-card">
      <h2 class="article-head">
        <a href="/2017/12/13/%E9%97%AD%E5%8C%85/">闭包</a>
      </h2>
      <p class="article-date">December 13, 2017</p>
      
        
  <a href="/tags#JavaScript" >
    <span class="tag-code">JavaScript</span>
  </a>

      
      <div class="article-summary">
        
          函数作为返回值高阶函数除了可以接受函数作为参数外，还可以把函数作为结果值返回。我们来实现一个对Array的求和。通常情况下，求和的函数是这样定义的:
123456function sum(arr) &#123;    return arr.reduce(function (x, y) &#1 ...
        
      </div>
      <a class="more" href="/2017/12/13/%E9%97%AD%E5%8C%85/">阅读更多</a>
    </article>
  
    <article class="article-card">
      <h2 class="article-head">
        <a href="/2017/12/13/%E9%AB%98%E9%98%B6%E5%87%BD%E6%95%B0/">高阶函数</a>
      </h2>
      <p class="article-date">December 13, 2017</p>
      
        
  <a href="/tags#JavaScript" >
    <span class="tag-code">JavaScript</span>
  </a>

      
      <div class="article-summary">
        
          高阶函数概述高阶函数英文叫Higher-order function。那么什么是高阶函数？JavaScript的函数其实都指向某个变量。既然变量可以指向函数，函数的参数能接收变量，那么一个函数就可以接收另一个函数作为参数，这种函数就称之为高阶函数。一个最简单的高阶函数:
12345funct ...
        
      </div>
      <a class="more" href="/2017/12/13/%E9%AB%98%E9%98%B6%E5%87%BD%E6%95%B0/">阅读更多</a>
    </article>
  
    <article class="article-card">
      <h2 class="article-head">
        <a href="/2017/12/13/JS%E6%96%B9%E6%B3%95/">JS方法</a>
      </h2>
      <p class="article-date">December 13, 2017</p>
      
        
  <a href="/tags#JavaScript" >
    <span class="tag-code">JavaScript</span>
  </a>

      
      <div class="article-summary">
        
          对象的方法在一个对象中绑定函数，称为这个对象的方法。在JavaScript中，对象的定义是这样的:
1234var xiaoming = &#123;    name: &#x27;小明&#x27;,    birth: 1990&#125;;
但是，如果我们给xiaoming绑定一个函数， ...
        
      </div>
      <a class="more" href="/2017/12/13/JS%E6%96%B9%E6%B3%95/">阅读更多</a>
    </article>
  
    <article class="article-card">
      <h2 class="article-head">
        <a href="/2017/12/13/%E5%8F%98%E9%87%8F%E4%BD%9C%E7%94%A8%E5%9F%9F%E4%B8%8E%E8%A7%A3%E6%9E%84%E8%B5%8B%E5%80%BC/">变量作用域与解构赋值</a>
      </h2>
      <p class="article-date">December 13, 2017</p>
      
        
  <a href="/tags#JavaScript" >
    <span class="tag-code">JavaScript</span>
  </a>

      
      <div class="article-summary">
        
          变量作用域在JavaScript中，用var申明的变量实际上是有作用域的。如果一个变量在函数体内部申明，则该变量的作用域为整个函数体，在函数体外不可引用该变量:
12345function foo() &#123;    var x = 1;    x = x + 1;&#125;x = x ...
        
      </div>
      <a class="more" href="/2017/12/13/%E5%8F%98%E9%87%8F%E4%BD%9C%E7%94%A8%E5%9F%9F%E4%B8%8E%E8%A7%A3%E6%9E%84%E8%B5%8B%E5%80%BC/">阅读更多</a>
    </article>
  
    <article class="article-card">
      <h2 class="article-head">
        <a href="/2017/12/04/JS%E5%87%BD%E6%95%B0%E5%AE%9A%E4%B9%89%E5%92%8C%E8%B0%83%E7%94%A8/">JS函数定义和调用</a>
      </h2>
      <p class="article-date">December 4, 2017</p>
      
        
  <a href="/tags#JavaScript" >
    <span class="tag-code">JavaScript</span>
  </a>

      
      <div class="article-summary">
        
          定义函数JavaScript函数时参数化的,并且每次调用还会有个上下文(this关键字).如果函数挂载在一个对象上,作为对象的一个属性,那就是对象的方法.JS的函数可以嵌套在其他函数中定义,这样它们就可以访问它们被定义时所处的作用域中的任何遍历.这意味着JS函数构成了一个闭包(closure ...
        
      </div>
      <a class="more" href="/2017/12/04/JS%E5%87%BD%E6%95%B0%E5%AE%9A%E4%B9%89%E5%92%8C%E8%B0%83%E7%94%A8/">阅读更多</a>
    </article>
  

  
    <div class="guide-pager">
  
    <a href="/page/8/"><span class="page-arrow">← </span>Prev</a>
  
  
    <a class="unvisible" href="/">Next <span class="page-arrow">→</span></a>
  
</div>
  
</main>


    <div class="scroll-top">
  <span class="arrow-icon"></span>
</div>
    <footer class="app-footer">
  <p class="copyright">
    &copy; 2024 | Proudly powered by <a href="https://hexo.io" target="_blank">Hexo</a>
    <br>
    Theme by <a target="_blank" rel="noopener" href="https://github.com/ltyeamin">tong.li</a>
  </p>
</footer>

<script>
  function async(u, c) {
    var d = document, t = 'script',
      o = d.createElement(t),
      s = d.getElementsByTagName(t)[0];
    o.src = u;
    if (c) { o.addEventListener('load', function (e) { c(null, e); }, false); }
    s.parentNode.insertBefore(o, s);
  }
</script>
<script>
  async("https://cdn.staticfile.org/fastclick/1.0.6/fastclick.min.js", function(){
    FastClick.attach(document.body);
  })
</script>

<script>
  var hasLine = 'true';
  async("https://cdn.staticfile.org/highlight.js/9.12.0/highlight.min.js", function(){
    $('figure pre').each(function(i, block) {
      var figure = $(this).parents('figure');
      if (hasLine === 'false') {
        figure.find('.gutter').hide();
      }
      hljs.configure({useBR: true});
      var lang = figure.attr('class').split(' ')[1] || 'code';
      var codeHtml = $(this).html();
      var codeTag = document.createElement('code');
      codeTag.className = lang;
      codeTag.innerHTML = codeHtml;
      $(this).attr('class', '').empty().html(codeTag);
      figure.attr('data-lang', lang.toUpperCase());
      hljs.highlightBlock(block);
    });
  })
</script>
<!-- Baidu Tongji -->



<script src='https://cdn.staticfile.org/mermaid/8.11.2/mermaid.min.js'></script>



<script src="/js/script.js"></script>


  </body>
</html>